<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@page import="sever.*,entity.*,java.util.*,java.text.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
        <table border="1" cellpadding="0" cellspacing="0">
   
            <tr>
            <td>学号</td>
            <td>课程名称</td>
            <td>课时</td>
            <td>年级</td>
            </tr>
           <%
              SubjectService subjectService=new SubjectService();
           int pageNo=1; 
           
           try{
          	   pageNo=Integer.parseInt(request.getParameter("pageNo"));
          	 }catch(Exception e){} 
              List <Subject> list= subjectService.paging(pageNo, 5);
              int total=subjectService.total();
              int pageTotal=total/5+(total%5==0?0:1);//总页数
              for(Subject s : list ){
            	  
           %>
           
           <tr>
                  <td><%=s.getId()%></td>
                  <td><%=s.getClasshour()%></td>
                  <td><%=s.getGradeid()%></td>
                  <td><%=s.getSubjectname()%></td>
           </tr>
           <%} %>
             
         </table>
         
          <%
              if(pageNo>1){
    
              %>
               <a href="SubjectFenye.jsp?pageNo=<%=pageNo-1%>"> 上页</a>
              <%} %>
            	 <%
            	    if(pageTotal>pageNo){
            	    	
            	 %>
            	 <a href="SubjectFenye.jsp?pageNo=<%=pageNo+1%>"> 下页</a>
            	 <% } %>
            	  <a href="SubjectFenye.jsp?pageNo=<%=pageTotal %>"> 尾页</a> 
           
</body>
</html>